package com.museum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.museum.entity.DO.Role;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Ruiwen
 * @since 2020-12-19
 */
@Repository
public interface RoleMapper extends BaseMapper<Role> {
    @Select("select count(*) from role where role_id = #{roleId} and area_number = #{areaNumber}")
    int selectCountByArea(Integer roleId, Integer areaNumber);

    @Select("SELECT role_name FROM role WHERE role_id=#{roleId}")
    String getRoleNameByRoleId(Integer role_id);

    @Select("select level from role where role_id = #{roleId}")
    int getLevelByRoleId(Integer roleId);

    @Select("select role_id  from role where area_number = #{areaNumber}")
    List<Integer> selectRoleIdsByAreaId(Integer areaNumber);

}
